package edu.suda.cxtz.modules.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Query {
    String propName() default "";

    Type type() default Type.EQUAL;

    String joinName() default "";

    Join join() default Join.LEFT;

    String blurry() default "";

    enum Type {
        EQUAL, //相等
        GREATER_THAN, //大于等于
        LESS_THAN, //小于等于
        INNER_LIKE, //在表内模糊查询
        LEFT_LIKE, //左模糊查询
        RIGHT_LIKE, // 右模糊查询
        LESS_THAN_NQ, //小于
        IN, //包含
        NOT_IN, //不包含
        NOT_EQUAL, //不等于
        BETWEEN, //在两者之间
        NOT_NULL, //不为空
        IS_NULL, //空
        // 对应SQL: SELECT * FROM table WHERE FIND_IN_SET('querytag', table.tags);
        FIND_IN_SET
    }

    enum Join {
        LEFT, RIGHT, INNER
    }
}
